﻿@model CTM.Web.Models.View.Conversation.ConversationViewModel

@{
    ViewBag.Title = "Delete Conversation";
    Layout = Request.IsAjaxRequest() ? null : "~/Views/Shared/_Layout.cshtml";
}

@if (!Request.IsAjaxRequest())
{
    <h2>Delete Conversation</h2>
    <h3>Are you sure you want to delete this conversation?</h3>
}
else
{
    <h5>Are you sure you want to delete this conversation?</h5>
}

<div>
    @if (!Request.IsAjaxRequest())
    {
        <dl class="dl-horizontal">
            <dt>
                @Html.DisplayNameFor(model => model.Title)
            </dt>

            <dd>
                @Html.DisplayFor(model => model.Title)
            </dd>
            <br />

            <dt>
                @Html.DisplayNameFor(model => model.Description)
            </dt>

            <dd>
                @Html.DisplayFor(model => model.Description)
            </dd>
            <br />

            <dt>
                @Html.DisplayNameFor(model => model.Emoticon)
            </dt>

            <dd>
                <div class="btn-group" data-toggle="buttons">
                    <label class="btn btn-rbvh btn-success @(Model.Emoticon == CTM.Web.Utils.Emoticon.Smile ? "active" : "")">
                        <span class="fa fa-lg fa-smile-o"></span>
                    </label>
                    <label class="btn btn-rbvh btn-warning @(Model.Emoticon == CTM.Web.Utils.Emoticon.Neutral ? "active" : "")">
                        <span class="fa fa-lg fa-meh-o"></span>
                    </label>
                    <label class="btn btn-rbvh btn-danger @(Model.Emoticon == CTM.Web.Utils.Emoticon.Frown ? "active" : "")">
                        <span class="fa fa-lg fa-frown-o"></span>
                    </label>
                </div>
            </dd>
            <br />

            <dt>
                @Html.DisplayNameFor(model => model.Type)
            </dt>

            <dd>
                <div class="btn-group" data-toggle="buttons">
                    <label class="btn btn-rbvh grey-darkgrey @(Model.Type == CTM.Web.Utils.PostType.Goals ? "active" : "")">
                        Goals
                    </label>
                    <label class="btn btn-rbvh blue-aqua @(Model.Type == CTM.Web.Utils.PostType.Career ? "active" : "")">
                        Career
                    </label>
                    <label class="btn btn-rbvh red-bittersweet @(Model.Type == CTM.Web.Utils.PostType.Individual ? "active" : "")">
                        Individual
                    </label>
                </div>
            </dd>
            <br />

            <dt>
                @Html.DisplayNameFor(model => model.Tags)
            </dt>

            <dd>
                <div class="tagcloud01" style="margin:0;">
                    <ul>
                        @foreach (var tag in Model.Tags)
                        {
                            <li>
                                <a>@tag.Name</a>
                            </li>
                        }
                    </ul>
                </div>
            </dd>
            <br />

            <dt>
                @Html.DisplayNameFor(model => model.Manager)
            </dt>

            <dd>
                @Html.DisplayFor(model => model.Manager.DisplayName)
            </dd>
        </dl>
    }
    
    @using (Ajax.BeginForm("Delete", "Conversation",
                    null,
                    new AjaxOptions { HttpMethod = "POST", OnSuccess = "OnDeleteConversationSuccess" },
                    new { @class = "form-horizontal", id = "delete-conversation-form" }))
    {
        @Html.AntiForgeryToken()

        if (!Request.IsAjaxRequest())
        {
            <div class="form-actions no-color">
                <input type="submit" value="Delete" class="btn btn-default" />
            </div>
        }
    }
</div>

<script>
    function OnDeleteConversationSuccess(data) {
        //Successful requests get here. Update the page elements
        $('#DeleteConversationModal').modal('hide');
        location.reload();
    }
</script>